import React, { Component, Children } from 'react'

export default class Dialog extends Component {
    timer = null
    render() {
        const { children, vis, dom } = this.props
        const mark = vis ? <div className="mark">
            <div className="warp">
                <div className={!dom ? 'warp_bot' : ''}>
                    {
                        Children.map(children, (item, index) => {
                            return <div className={!dom ? 'dis' : ''} key={index}>
                                {item}
                            </div>
                        })
                    }
                </div>
            </div>
        </div> : <></>
        return (
            <div className='h100 dialog'>
                {mark}
            </div>
        )
    }
    componentDidUpdate(props) {
        clearTimeout(this.timer)
        this.timer = setTimeout(() => {
            this.props.fn(false)
        }, 2000)
    }
}
